package net.cyan.activex;

import java.util.*;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author ccs
 * @version 1.0
 */

abstract public class Dll
{
   /**
    * 保存所有的实例
    */
   static private Map instances = new Hashtable();

   static protected Dll create(Class c, String dll) throws ActiveXException
   {
      return DllProxy.createObject(c, dll);
   }

   static protected Dll getInstance(Class c, String dll) throws
       ActiveXException
   {
      synchronized (c)
      {
         Dll instance = (Dll) instances.get(c);
         if (instance == null)
         {
            instance = create(c, dll);
            instances.put(c, instance);
         }

         return instance;
      }
   }

   protected Dll()
   {
   }
}
